<template>
  <div>
    <span>菜单一子组件</span>
    <div>
      <span>父组件传的数据:{{ par }}</span>
    </div>
    <div>
      <button @click="returnParent">回馈父组件</button>
    </div>
    <div>
      <span>
        {{ parentFunValue }}
      </span>
    </div>
  </div>
</template>
<script>
export default {
  name: "menu1Child",
  props: {
    par: {
      type: String,
      default: "父组件来值",
    },
  },
  data() {
    return {
      childMessage: "子组件返回数据啦",
      parentFunValue: "",
    };
  },
  created() {
    this.parentFun();
  },
  mounted() {},
  methods: {
    returnParent() {
      this.$emit("childFn", {
        message: this.childMessage,
        isShow: false,
      });
    },
    parentFun() {
      this.parentFunValue = this.$parent.exeChildFun();
    },
  },
};
</script>
<style scoped></style>
